#include <cstdint>

class Solution {
public:
    uint32_t reverseBits(uint32_t n) {
        uint32_t ret = 0;
        uint32_t m = 1;
        m <<= 31;
        do {
            ret += (n & 1) * m;
            n >>= 1;
            m >>= 1;
        } while (m > 0);
        return ret;
    }
};